# -*- coding: utf-8 -*-
#当前所属项目：ailearning
#文件名：output-prompt
#当前用户：李峰
#当前时间：2025/9/21 0:00
#模块说明：输出解析
from langchain_core.output_parsers import PydanticOutputParser
from langchain_core.prompts import  PromptTemplate
from langchain_openai import OpenAI
from pydantic import BaseModel,Field,model_validator

model =OpenAI(model_name='qwen-plus',base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",temperature=0.5,api_key="sk-7b4f290b1a3e42a1a9a1957fa44eff37")

# 借助提示词模板输出
class Joke(BaseModel):
    setup:str = Field(description="设置消化的问题")
    punchline:str = Field(description="解答笑话的答案")
# 设置解析器将指令注入提示词模版
parser=PydanticOutputParser(pydantic_object=Joke)
prompt =PromptTemplate()



